//request 是一个axios对象（经过设置信息的）
import request from '@/utils/request'


//上传图片
export function uploadImage(data) {
    return request({
        //设置请求数据格式为multipart/form-data
        headers: {"Content-Type": "multipart/form-data;charset=UTF-8"},
        url: '/api/user/image/upload',
        method: 'post',
        data
    })
}


export function page(data) {
    return request({
        url: '/api/admin/dish/page',
        //post请求
        method: 'post',
        data
    })
}

export function remove(data) {
    return request({
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/admin/dish/remove',
        //post请求
        method: 'post',
        data
    });
}

export function add(data) {
    return request({
        url: '/api/admin/dish/add',
        //post请求
        method: 'post',
        data
    });
}

export function checkById(data) {
    return request({
        url: '/api/admin/dish/checkById',
        //post请求
        method: 'post',
        data
    });
}


export function checkByName(data) {
    return request({
        url: '/api/admin/dish/checkByName',
        //post请求
        method: 'post',
        data
    });
}

// 通过审核

export function dishPass(data) {
    return request({
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/admin/dish/dishPass',
        //post请求
        method: 'post',
        data
    });
}


export function find(data) {
    return request({
        url: '/api/admin/dish/checkById',
        //post请求
        method: 'post',
        data
    });
}

// 取消的函数，删除冗余的图片
export function cancel(data) {
    return request({
        url: '/api/admin/users/cancel',
        //post请求
        method: 'post',
        data
    })
}


export function update(data) {
    return request({
        url: '/api/admin/dish/update',
        //post请求
        method: 'post',
        data
    })
}